{% extends 'base_foot.html' %}

{% block body %}
    <div class="header_con" id="header_con">
		<div class="header">
			<div class="welcome fl">欢迎来到跳蚤市场!</div>
			<div class="fr">
{#                判断是否已经登录#}
                {% if request.session.user_name|default:'' != '' %}
{#                    default过滤器进行判断如果request.session.user_name不等于空字符串则用户登陆状态为true#}
{#                    也就是说当用户为已登陆状态时则显示用户名#}

{#                    class="login_info fl"#}
				<div class="login_btn fl">
                    <img class="img-circle" align="center" src="{{ MEDIA_URL }}{{ user.ulogo }}" alt="头像"/>
                    <font color="#ff4500">{{ request.session.user_name }}</font>
				</div>
                <div class="login_btn fl">
                    <span>|</span>
                    <em><a href="{% url "df_user:logout" %}">退出</a></em>
				</div>
                {% else %}
				<div class="login_btn fl">
					<a href="{% url "df_user:login" %}">登录</a>
					<span>|</span>
					<a href="{% url "df_user:register" %}">注册</a>
				</div>
                {% endif %}
				<div class="user_link fl">
					<span>|</span>
					<a href="{% url "df_user:info" %}">用户中心</a>
                    <span>|</span>
					<a href="{% url "df_user:message" %}">消息中心</a>
					<span>|</span>
					<a href="{% url "df_cart:cart" %}">我的购物车</a>
					<span>|</span>
					<a href="{% url "df_user:order" 1 %}">我的订单</a>
				</div>
			</div>
		</div>
	</div>


    <div class="search_bar clearfix">
		<a href="/" class="logo fl"><img src="/static/images/logo1.png"></a>
{#        {% if page_name == 1 %}#}
{#            <div class="sub_page_name fl">{{ title }}</div>#}
{#        {% endif %}#}
		<div class="search_con fl">
             <script>
                $(function () {
                    $('.input_btn').click(function () {
                        q = $('.input_text').val();
                        if(q==""){
                        alert("请输入搜索内容");
                        }
                        else{
                            location.href = '{% url "df_goods:ordinary_search" %}?q='+q+'&page=1'
                        }
                    })
                })

            </script>
			<input type="text" class="input_text fl" name="q" placeholder="搜索商品">
			<input type="button" class="input_btn fr" name="" value="搜索">
		</div>

        {% if guest_cart == 1 %}
            <div class="guest_cart fr">
                <a href="{% url "df_cart:cart" %}" class="cart_name fl">我的购物车</a>
                <div class="goods_count fl" id="show_count">{{ cart_num }}</div>
            </div>
        {% else %}
            <div class="guest_cart fr">
                <a href="{% url "df_cart:cart" %}" class="cart_name fl">我的购物车</a>
                <div class="goods_count fl" id="show_count">0</div>
            </div>
        {% endif %}
	</div>
{% block content %}
{% endblock content %}
{% block center_body %}
{% endblock center_body %}


{% endblock body %}